﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
	CodeBehind="Details.aspx.cs" Inherits="TraceThisItem.WebUI.Items.Details" %>

<asp:Content ID="Head" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Body" ContentPlaceHolderID="MainContent" runat="server">
	<h1>
		Ver detalle de incidencia
	</h1>
	&nbsp;<asp:ValidationSummary ID="ValidationSummary1" runat="server" />
	<hr />
	<h1>
		<asp:Label ID="lblSelectedItemSubject" ForeColor="Green" runat="server" />
	</h1>
	<table width="100%">
		<tr>
			<td>
				<asp:Label ID="lblSelectedItemDescription" runat="server" />
			</td>
			<td>
				<asp:Label ID="lblSelectedItemProject" runat="server" />
			</td>
		</tr>
		<tr>
			<td>
				<asp:Label ID="lblSelectedItemCreatedOn" runat="server" />
			</td>
			<td>
				<asp:Label ID="lblSelectedItemType" runat="server" />
			</td>
		</tr>
		<tr>
			<td>
				<asp:Label ID="lblSelectedItemCurrentResponsible" runat="server" />
			</td>
			<td>
				<asp:Label ID="lblSelectedItemTeam" runat="server" />
			</td>
		</tr>
		<tr>
			<td>
				<asp:Label ID="lblSelectedItemCurrentStatus" Font-Bold="true" runat="server" />
			</td>
			<td>
				<asp:Label ID="lblSelectedItemWorkflow" runat="server" />
			</td>
		</tr>
		<tr>
			<td>
				<asp:Label ID="lblSelectedItemLastUpdateOn" Font-Bold="true" runat="server" />
			</td>
			<td>
				<asp:Label ID="lblSelectedItemCurrentPriority" Font-Bold="true" runat="server" />
			</td>
		</tr>
	</table>
	<hr />
	<h1>
		<asp:Label ID="lblActualizarDatos" ForeColor="Green" runat="server" Text="Actualizar datos de incidencia" />
	</h1>
	<p>
		Nueva Prioridad:
		<asp:DropDownList ID="ItemPriorityDropDownList" runat="server" Width="162px">
			<asp:ListItem Text="Alta" Selected="True" Value="2" />
			<asp:ListItem Text="Normal" Value="1" />
			<asp:ListItem Text="Baja" Value="0" />
		</asp:DropDownList><br />
		Nuevo Estado:
		<asp:DropDownList ID="NextStatusesDropDownList" runat="server" Width="174px" 
			DataSourceID="NextStatusesDataSource" DataTextField="Name" DataValueField="Id">
		</asp:DropDownList><br />
		Nuevo Responsable:
		<asp:DropDownList ID="NextResponsibleDropDownList" runat="server" Width="138px" 
			DataSourceID="ResponsableDataSource" DataTextField="FullName" 
			DataValueField="UserName">
		</asp:DropDownList>
	</p>
	<p>
		Comentarios:<br />
		<asp:TextBox ID="TextBoxComments" runat="server" Height="126px" TextMode="MultiLine"
			Width="641px"></asp:TextBox>
	</p>
	<hr />
	<h1>
		<asp:Label ID="lbltraceability" ForeColor="Green" runat="server" Text="Trazabilidad de la incidencia" />
	</h1>
	<p>
		<asp:GridView ID="TraceabilityGridView" runat="server" 
			AutoGenerateColumns="False" DataSourceID="TraceabilityDataSource" Width="917px" 
			EmptyDataText="No hay datos de trazabilidad anteriores">
			<Columns>
				<asp:BoundField DataField="Date" HeaderText="Fecha" SortExpression="Date" />
				<asp:TemplateField ConvertEmptyStringToNull="False" HeaderText="Responsable" 
					SortExpression="Responsible">
					<EditItemTemplate>
						<asp:DynamicControl ID="DynamicControl2" runat="server" DataField="Responsible" 
							Mode="Edit" />
					</EditItemTemplate>
					<ItemTemplate>
						<asp:Label ID="lblResponsibleTraceability" runat="server" 
							Text='<%# Eval("Responsible.FullName") %>'></asp:Label>
					</ItemTemplate>
				</asp:TemplateField>
				<asp:TemplateField ConvertEmptyStringToNull="False" HeaderText="Estado" 
					SortExpression="StatusNode">
					<EditItemTemplate>
						<asp:DynamicControl ID="DynamicControl1" runat="server" DataField="StatusNode" 
							Mode="Edit" />
					</EditItemTemplate>
					<ItemTemplate>
						<asp:Label ID="lblEstadoTrazabilidad" runat="server" 
							Text='<%# Eval("StatusNode.Name") %>'></asp:Label>
					</ItemTemplate>
				</asp:TemplateField>
			</Columns>
		</asp:GridView>
	</p>
	<hr />
	<h1>
		<asp:Label ID="lblAcciones" ForeColor="Green" runat="server" Text="Acciones" />
	</h1>
	<p>
		<asp:Button ID="btnModificarIncidencia" Text="Modificar Incidencia" 
			runat="server" onclick="btnModificarIncidencia_Click" />
	</p>
	<asp:ObjectDataSource ID="SelectedItemDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
		SelectMethod="GetItemById" TypeName="TraceThisItem.Domain.Facade" OnObjectCreating="SelectedItemDataSource_ObjectCreating"
		OnSelected="SelectedItemDataSource_Selected" 
		onupdated="SelectedItemDataSource_Updated" 
		onupdating="SelectedItemDataSource_Updating" UpdateMethod="UpdateItem">
		<SelectParameters>
			<asp:QueryStringParameter DefaultValue="0" Name="itemId" QueryStringField="id" Type="Int32" />
		</SelectParameters>
		<UpdateParameters>
			<asp:Parameter Name="itemId" Type="Int32" />
			<asp:Parameter Name="comments" Type="String" />
			<asp:Parameter Name="responsible" Type="Object" />
			<asp:Parameter Name="priority" Type="Byte" />
			<asp:Parameter Name="nextStatus" Type="Object" />
		</UpdateParameters>
	</asp:ObjectDataSource>
	<asp:ObjectDataSource ID="TraceabilityDataSource" runat="server" 
		OldValuesParameterFormatString="original_{0}" 
		onobjectcreating="TraceabilityDataSource_ObjectCreating" 
		SelectMethod="GetTracebilityByItemId" TypeName="TraceThisItem.Domain.Facade">
		<SelectParameters>
			<asp:QueryStringParameter DefaultValue="0" Name="itemId" QueryStringField="id" 
				Type="Int32" />
		</SelectParameters>
	</asp:ObjectDataSource>
	<asp:ObjectDataSource ID="WorkflowDataSource" runat="server" 
		OldValuesParameterFormatString="original_{0}" 
		onobjectcreating="WorkflowDataSource_ObjectCreating" 
		onselected="WorkflowDataSource_Selected" 
		onselecting="WorkflowDataSource_Selecting" SelectMethod="GetWorkFlowById" 
		TypeName="TraceThisItem.Domain.Facade">
		<SelectParameters>
			<asp:Parameter DefaultValue="0" Name="workflowId" Type="Int32" />
		</SelectParameters>
	</asp:ObjectDataSource>
	<asp:ObjectDataSource ID="NextStatusesDataSource" runat="server" 
		OldValuesParameterFormatString="original_{0}" 
		onobjectcreating="NextStatusesDataSource_ObjectCreating" 
		onselected="NextStatusesDataSource_Selected" 
		onselecting="NextStatusesDataSource_Selecting" 
		SelectMethod="GetNextStatusesByWorkflowIdAndCurrentStatusId" 
		TypeName="TraceThisItem.Domain.Facade">
		<SelectParameters>
			<asp:Parameter DefaultValue="0" Name="workflowId" Type="Int32" />
			<asp:Parameter DefaultValue="0" Name="currentStatusId" Type="Int32" />
		</SelectParameters>
	</asp:ObjectDataSource>
	<asp:ObjectDataSource ID="ResponsableDataSource" runat="server" 
		OldValuesParameterFormatString="original_{0}" 
		onobjectcreating="ResponsableDataSource_ObjectCreating" 
		onselecting="ResponsableDataSource_Selecting" SelectMethod="GetUsersByProject" 
		TypeName="TraceThisItem.Domain.Facade">
		<SelectParameters>
			<asp:Parameter Name="projectId" Type="Int32" />
		</SelectParameters>
	</asp:ObjectDataSource>
</asp:Content>
